package dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

import entity.Association;
import entity.Employee;
import entity.PayMethod;
import entity.PaymentReport;

@Stateless
public class PayMethodDao {
	@PersistenceContext
	EntityManager manager;
	
	public void registerPayMethod(PayMethod method){
		manager.persist(method);
	}
	public void updatePayMethod(PayMethod method){
		manager.merge(method);
	}
	public PayMethod findPayMethod(int id){
		PayMethod paymethod=manager.find(PayMethod.class, id);
		return paymethod;
	}
	public int deletePaymethod(PayMethod method){
		try {
			PayMethod deletedmethod=manager.merge(method);
			manager.remove(deletedmethod);	
		}
		catch (Exception e){
			return -1;
		}
		return 0;
	}
}
